'''
Created on 30/03/2012

@author: glenn
'''

import unittest
import os
import json
import zipfile

if __name__ == "__main__":
    import sys
    sys.path.append('..')

from converter import *
from odp_png_converter import *
#from formatter import ZipFormatter, AudioFormatter
#import zipfile

class TestHTMLConverter(unittest.TestCase):
    def setUp(self):
        #self._odpFileName = "2slide-presentation.odp"
        self._odpFileName = "4slide-presentation.odp"
        base = os.path.splitext(self._odpFileName)[0]
        self._zipFileName = base + ".zip"
        self._htmlZipFileName = base + ".html.zip"

    #@unittest.skip("")
    def test_ZippedHTML5Converter(self):
        
        c = ODPScriptConverter(self._odpFileName, "en")
        i = ODPPngConverter(self._odpFileName, c)
        # use preconverted slide images for testing
        #i = ImageConverter("slide_images", c)
        a = AudioConverter(i)
        z = ZippedHTML5Converter(self._htmlZipFileName, os.path.join("..", "templates"), a)
        z.convert()
        
        print "tempDir was", z.tempDir()
        
        myzip = zipfile.ZipFile(self._htmlZipFileName, "r")
        for info in myzip.infolist():
            print info.filename, info.date_time, info.file_size, info.compress_size
            # not sure how to test this
        myzip.close()

if __name__ == "__main__":
    unittest.main()
